﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace Projektet.Model
{
    class Pikeman : CombatUnit
    {

        public Pikeman(PlayerType playerType, Vector2 startPos, UnitStats unitstats) 
        {
            _width = 2;
            _height = 5;
            _attackInterval = unitstats.PikemanAttackSpeed;
            _moveSpeed = unitstats.PikemanMoveSpeed;
            _playerType = playerType;
            if (playerType == PlayerType.Npc)
            {
                _moveSpeed *= -1f;
            }

            _damage = unitstats.PikemanDamage;
            _health = unitstats.PikemanHealth;
            //_unitRect = new Rectangle((int)startPos.X, (int)startPos.Y, _width, _height);
            _unitPosition = new Vector2(startPos.X, startPos.Y);
        }

        public override void TakeDamage(Combat.Attack attack)
        {
            //If-satser eller switch som avgör hur mycket damage som ska tas beroende på enhetstyp
            //Console.WriteLine(_health);
            switch (attack.AttackType)
            {
                case Combat.AttackType.Arrow:
                    _health -= (attack.Power * 1.5f);
                    break;
                case Combat.AttackType.Pike:
                    _health -= attack.Power;
                    break;
                case Combat.AttackType.Sword:
                    _health -= (attack.Power / 1.5f);
                    break;
                case Combat.AttackType.Other:
                    _health -= attack.Power;
                    break;
            }
        }
        //public override void Update(GameTime gameTime) 
        //{
        //    Console.WriteLine("Pikemans egna update!");
        //}
    }
}
